import numpy as np
import torch
import torch.nn.functional as F
import os

def gen_golden_data_simple():
    """简化版本的 ConstantPad 测试数据生成"""
    np.random.seed(42)
    torch.manual_seed(42)

    # 生成输入数据
    input_x_np = np.random.uniform(-1.0, 1.0, [8, 1, 9, 2045]).astype(np.float32)
    input_x = torch.from_numpy(input_x_np)
    
    # 填充参数
    pad_sizes = [1, 2, 3, 4]  # left, right, top, bottom
    pad_value = 0.0
    
    # PyTorch ConstantPad
    golden = F.pad(input_x, pad=pad_sizes, mode='constant', value=pad_value)
    
    # 保存文件
    os.makedirs("./input", exist_ok=True)
    os.makedirs("./output", exist_ok=True)
    input_x_np.tofile("./input/input_x.bin")
    golden.numpy().tofile("./output/golden.bin")

if __name__ == "__main__":
    gen_golden_data_simple()